import request from '@/utils/request'
import upload from '@/utils/upload'

// 获得地区树
export function getAreaTreeApi() {
	return request({
		url:'/system/area/tree',
		method:'GET'
	})
}
// 获得客户精简消息列表
export function getCustomerListApi(){
	return request({
		url: '/crm/customer/simple-list',
		method: 'GET'
	})
}
// 通过客户获得联系人
export function getContactApi(id){
	return request({
		url: `/crm/contact/page-by-customer?customerId=${id}`,
		method: 'GET'
	})
}
// 文件存储
export function updateFileApi(file){
	return upload({
		url: `/infra/file/upload?file=${file}`,
		method: 'POST',
		filePath: file
	})
}
// 获得用户精简信息列表
export function getUserListApi(){
	return request({
		url: '/system/user/list-all-simple',
		method: 'GET'
	})
}
// 获得操作记录
export function getOperateListApi(data){
	return request({
		url: '/system/operate-log/page',
		method: 'GET',
		params: data
	})
}

// 创建资源
export function createResourceApi(data){
	return request({
		url: '/crm/resource/create',
		method: 'POST',
		data: data
	})
}
// 获取资源分页
export function getResourceListApi(data){
	return request({
		url: '/crm/resource/page',
		method: 'GET',
		params: data
	})
}
// 删除资源
export function deleteResourceApi(id){
	return request({
		url: `/crm/resource/delete?id=${id}`,
		method: 'DELETE'
	})
}